package com.xwaf.platform.system.social.task;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.xwaf.platform.system.api.entity.DataBase;
import com.xwaf.platform.system.api.entity.auth.OperateLog;
import com.xwaf.platform.system.api.service.auth.OperateLogService;

public class LogTask implements Runnable {

	/**
	 * 日志对象
	 */
	private static Logger LOGGER = LoggerFactory.getLogger(LogTask.class);

	private OperateLogService logService;
	private OperateLog operateLog;

	public LogTask(OperateLogService logService, OperateLog log) {
		this.logService = logService;
		this.operateLog = log;
	}

	@Override
	public void run() {
		try {
			operateLog.setId(DataBase.getDataBaseId(DataBase.OL));
			logService.insert(operateLog);
		} catch (Exception e) {
			LOGGER.error("====添加操作日志失败=========", operateLog);
		}
	}

	public OperateLogService getLogService() {
		return logService;
	}

	public void setLogService(OperateLogService logService) {
		this.logService = logService;
	}

	public OperateLog getOperateLog() {
		return operateLog;
	}

	public void setOperateLog(OperateLog operateLog) {
		this.operateLog = operateLog;
	}
}
